package com.yvon.boot.jwt.model;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

/**
 * AuthInfo
 *
 * @author : Yvon
 * @since : 2021-09-02
 */
@Data
@Accessors(chain = true)
@ApiModel(description = "认证信息")
public class AuthInfo {

    @ApiModelProperty(value = "令牌")
    private String token;

    @ApiModelProperty(value = "令牌类型")
    private String tokenType;

    @ApiModelProperty(value = "头")
    private String header;

    @ApiModelProperty(value = "刷新令牌")
    private String refreshToken;


    @ApiModelProperty(value = "账号名")
    private String username;

    @ApiModelProperty(value = "用户id")
    private Long id;

    @ApiModelProperty(value = "过期时间（秒）")
    private Long expire;

    @ApiModelProperty(value = "到期时间")
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime expiration;

    @ApiModelProperty(value = "有效期")
    private Long expireMillis;
}
